<!DOCTYPE html>
<html lang="en">
  <head>
	<meta name="generator" content="Hugo 0.136.0">
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keyword" content="">

    <link rel="shortcut icon" href="/node-mongodb-native//s/img/favicon.ico">

    <title>MongoDB Node.js Driver</title>

    <link rel="stylesheet" href="/node-mongodb-native//s/lib/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native//s/lib/font-awesome/css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native//s/lib/highlight/styles/vs.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native//s/lib/bootstrap-select/bootstrap-select.min.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native//s/lib/bootstrap-toggle/bootstrap-toggle.min.css" type="text/css" />
<link rel="stylesheet" href="/node-mongodb-native//s/css/frontpage.css" type="text/css" />

  </head>

  <body>
  
  <header id="header-db" class="row" role="navigation">
  <div class="header-content">
    
    <div class="logo pull-left">
      <a href="/node-mongodb-native/">
        <img src="/node-mongodb-native//s/img/logo-mongodb-header-slate.png", alt="MongoDB.org" />
      </a>
    </div>
    
    <div>
<div class="nav-items pull-right hidden-xs">
  <a href="https://university.mongodb.com" data-toggle="tooltip" data-placement="bottom" title="Free Online Classes">MongoDB University</a>
  <a href="https://www.mongodb.com/try" data-toggle="tooltip" data-placement="bottom" title="Download MongoDB">Downloads</a>
  <a href="https://www.mongodb.com/community" data-toggle="tooltip" data-placement="bottom" title="Get involved with MongoDB">Community</a>
  <a href="https://www.mongodb.com/docs" data-toggle="tooltip" data-placement="bottom" title="The MongoDB Documentation">Docs</a>
  <a href="https://www.mongodb.com/blog" data-toggle="tooltip" data-placement="bottom" title="The MongoDB Blog">Blog</a>
</div>
</div>

  </div>
</header>

  

  <div id="hero" class="jumbotron">
  <div class="container">
  <div class="row">
    <div class="col-md-2"></div>
    <div class="col-md-6">
      <h2>MongoDB Node.js Driver</h2>
      <p>
        The next generation Node.js driver for MongoDB
      </p>
      <p>
        
        
        <a href="https://www.mongodb.com/docs/drivers/node" class="btn btn-success btn-dark btn-mongo">Latest documentation</a>
      </p>

    </div>
  </div>
  </div>
</div>


  
  <div class="container" id="mainContent">
    <div class="row">
      <div class="col-md-8">
        <h2>Introduction</h2>

<p>
  The official MongoDB Node.js driver allows Node.js applications to connect to MongoDB and work with data.
  The driver features an asynchronous API which allows you to interact with MongoDB using Promises or via traditional callbacks.
</p>


        <h2>Features</h2>

<dl>
  <dt>MongoDB Driver</dt>
  <dd>
	Whether you are new to MongoDB or you just want to brush up on the core concepts, you can check out the Fundamentals section which features material on using the Node.js driver for the following:
	<ul>
		<li><a href="https://www.mongodb.com/docs/drivers/node/current/fundamentals/connection">Connection Guide</a>: connect to a MongoDB instance or replica set</li>
		<li><a href="https://www.mongodb.com/docs/drivers/node/current/fundamentals/authentication">Authentication</a>: configure authentication and log a user in</li>
		<li><a href="https://www.mongodb.com/docs/drivers/node/current/fundamentals/crud">CRUD Operations</a>: read and write data to MongoDB</li>
		<li><a href="https://www.mongodb.com/docs/drivers/node/current/fundamentals/promises">Promises and Callbacks</a>: access return values using asynchronous Javascript</li>
		<li><a href="https://www.mongodb.com/docs/drivers/node/current/fundamentals/indexes">Indexes</a>: create and design indexes to make your queries efficient</li>
		<li><a href="https://www.mongodb.com/docs/drivers/node/current/fundamentals/collations">Collations</a>: apply language-specific sorting rules to your query results</li>
		<li><a href="https://www.mongodb.com/docs/drivers/node/current/fundamentals/logging">Logging</a>: configure the driver to log MongoDB operations</li>
		<li><a href="https://www.mongodb.com/docs/drivers/node/current/fundamentals/monitoring">Monitoring</a>: configure the driver to monitor MongoDB server events</li>
	</ul>
  </dd>
</dl>


        <h2 id="quickStart">Quick Start</h2>

<p>Given that you have created your own project using `npm init` we install the mongodb driver and its dependencies by executing the following `npm` command.</p>

<p><code>
npm install mongodb --save
</code></p>

<p>
This will download the MongoDB driver and add a dependency entry in your `package.json` file.
</p>
        
        <hr/>
        
        <section id="universityPromo">
  <h3><span>MongoDB University</span></h3>
  <br/>
  <h4>Using MongoDB with Node.js</h4>
  <p>This course guides you through everything you need to get started with MongoDB in your NodeJS applications. In this course, you’ll get an overview of the official MongoDB NodeJS/Javascript driver and learn how to install it by using npm. You’ll learn how to connect your application, perform basic CRUD operations, troubleshoot, and then build aggregations.</p>
  <p>
    <a href="https://learn.mongodb.com/learning-paths/using-mongodb-with-nodejs" target="_blank" class="btn btn-success btn-mongo">Learn More</a>
  </p>
  <br/>
  <h4>MongoDB Node.js Developer Path</h4>
  <p>This learning path contains a series of courses to teach you MongoDB skills. In this path, you’ll learn the basics of building modern applications with Node.JS, using MongoDB as your database.</p>
  <p>
    <a href="https://learn.mongodb.com/learning-paths/mongodb-nodejs-developer-path" target="_blank" class="btn btn-success btn-mongo">Learn More</a>
  </p>
</section>

      </div>
      <div class="col-md-4">
        
<section id="releases">
  <h2>Releases</h2>
  <table class="table table-striped">
    <thead><tr><th>Release</th><th>Documentation</th></tr></thead>
    <tbody>
    
      <tr>
        <th class="next">Next Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./Next">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="latest">6.15 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.15">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.14 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.14">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.13 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.13">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.12 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.12">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.11 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.11">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.10 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.10">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.9 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.9">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.8 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.8">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.7 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.7">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.6 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.6">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.5 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.5">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.4 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.4">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.3 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.3">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.2 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.2">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.1 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.1">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">6.0 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./6.0">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.9 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.9">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.8 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.8">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.7 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.7">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.6 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.6">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.5 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.5">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.4 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.4">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.3 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.3">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.2 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.2">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.1 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.1">API</a>

        </td>
      </tr>
    
      <tr>
        <th class="supported">5.0 Driver</th>
        <td>

          
            <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
          

          &#124; 

          <a href="./5.0">API</a>

        </td>
      </tr>
    
  </tbody>
  </table>

  <details>
    <summary class="legacy-summary">Legacy Versions</summary>
    <p>⚠️ The following versions are no longer maintained. For the latest bug fixes and features, please upgrade to a version listed above.</p>
    <table class="table table-striped">
      <thead><tr><th>Release</th><th>Documentation</th></tr></thead>
      <tbody>
      
        <tr>
          <th class="not-supported">4.17 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.17">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.16 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.16">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.15 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.15">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.14 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.14">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.13 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.13">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.12 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.12">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.11 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.11">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.10 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.10">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.9 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.9">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.8 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.8">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.7 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.7">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.6 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.6">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.5 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.5">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.4 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.4">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.3 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.3">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.2 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.2">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.1 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.1">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">4.0 Driver</th>
          <td>

            
              <a href="https://www.mongodb.com/docs/drivers/node/" class="reference">Reference</a>
            

            &#124; 

            <a href="./4.0">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">3.7 Driver</th>
          <td>

            
              <a href="./3.7" class="reference">Reference</a>
            

            &#124; 

            <a href="./3.7/api">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">3.6 Driver</th>
          <td>

            
              <a href="./3.6" class="reference">Reference</a>
            

            &#124; 

            <a href="./3.6/api">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">3.5 Driver</th>
          <td>

            
              <a href="./3.5" class="reference">Reference</a>
            

            &#124; 

            <a href="./3.5/api">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">3.4 Driver</th>
          <td>

            
              <a href="./3.4" class="reference">Reference</a>
            

            &#124; 

            <a href="./3.4/api">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">3.3 Driver</th>
          <td>

            
              <a href="./3.3" class="reference">Reference</a>
            

            &#124; 

            <a href="./3.3/api">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">3.2 Driver</th>
          <td>

            
              <a href="./3.2" class="reference">Reference</a>
            

            &#124; 

            <a href="./3.2/api">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">3.1 Driver</th>
          <td>

            
              <a href="./3.1" class="reference">Reference</a>
            

            &#124; 

            <a href="./3.1/api">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">3.0 Driver</th>
          <td>

            
              <a href="./3.0" class="reference">Reference</a>
            

            &#124; 

            <a href="./3.0/api">API</a>

          </td>
        </tr>
      
        <tr>
          <th class="not-supported">2.2 Driver</th>
          <td>

            
              <a href="./2.2" class="reference">Reference</a>
            

            &#124; 

            <a href="./2.2/api">API</a>

          </td>
        </tr>
      
    </tbody>
    </table>
  </details>


</section>

        
     </div>
    </div>
  </div>
  

  
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <div class="footer">
  <div class="copyright">
    <p>Copyright © 2022 <a class="smalltext" href="https://www.mongodb.com">MongoDB, Inc</a>.
      Licensed under <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/ ">Creative Commons</a>.
      MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc.
      </p>
  </div>
</div>

      </div>
    </div>
  </div>
  



<script type="text/javascript" src="/node-mongodb-native//s/js/jquery.js"></script>
<script type="text/javascript" src="/node-mongodb-native//s/lib/bootstrap.js"></script>
<script type="text/javascript" src="/node-mongodb-native//s/lib/highlight/highlight.pack.js"></script>
<script type="text/javascript" src="/node-mongodb-native//s/lib/bootstrap-select/bootstrap-select.min.js"></script>
<script type="text/javascript" src="/node-mongodb-native//s/lib/bootstrap-toggle/bootstrap-toggle.min.js"></script>
<script type="text/javascript" src="/node-mongodb-native//s/lib/zeroclipboard/ZeroClipboard.min.js"></script>
<script type="text/javascript" src="/node-mongodb-native//s/js/frontpage.js"></script>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-29229787-1', 'auto');
  ga('send', 'pageview');
</script>
</body>
</html>
